var activeTab = null;
var targetTab = null;
var createStatus = {};
export function switchTab(idx, tabs) {
	if (!tabs) {
		targetTab = './index.index.html';
	} else {
		targetTab = tabs[idx].src;
	}
	var subpage_style = {
		top: '0px',
		bottom: '56px',
		render: 'always',
		bounce: 'vertical'
	};
	if(targetTab == activeTab) {
		return;
	}
	//显示目标选项卡
	if(createStatus[targetTab]) {
		plus.webview.show(targetTab, "fade-in", 100);
	} else {
		var self = plus.webview.currentWebview();
		var sub = plus.webview.create(targetTab, targetTab, subpage_style);
		createStatus[targetTab] = "true"; //已创建
		self.append(sub);
		sub.show();
	}
	//更改当前活跃的选项卡
	activeTab = targetTab;
	
}